package org.lab.tracecash.web.servlet;

import org.jboss.resteasy.plugins.guice.ext.RequestScopeModule;
import org.lab.tracecash.guice.TracecashCoreModule;
import org.lab.tracecash.web.model.json.GsonExceptionHandler;
import org.lab.tracecash.web.model.json.GsonMessageBodyHandler;
import org.lab.tracecash.web.rest.I18nRestService;
import org.lab.tracecash.web.rest.impl.AccountRestService;
import org.lab.tracecash.web.rest.impl.TransactionRestService;
import org.lab.tracecash.web.rest.impl.UserRestService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.google.inject.Binder;
import com.google.inject.Module;

public class RestModule implements Module {

	private static final Logger LOG = LoggerFactory.getLogger(RestModule.class);

	@Override
	public void configure(Binder binder) {
		LOG.debug("Configuring Guice Module");
		binder.install(new TracecashCoreModule());
		binder.install(new RequestScopeModule());
		binder.bind(GsonMessageBodyHandler.class);
		binder.bind(GsonExceptionHandler.class);

		binder.bind(AccountRestService.class);
		binder.bind(TransactionRestService.class);
		binder.bind(UserRestService.class);
		binder.bind(I18nRestService.class);
	}
}
